package com.example.abstractfactory.factory;

import com.example.abstractfactory.color.Color;
import com.example.abstractfactory.factory.AbstractFactory;
import com.example.abstractfactory.shape.Shape;
import com.example.abstractfactory.shape.impl.Circle;
import com.example.abstractfactory.shape.impl.Rectangle;
import com.example.abstractfactory.shape.impl.Square;
import org.springframework.util.StringUtils;

/**
 * @Description TODO
 * @Date 2021/10/21 10:42
 * @Author ZhangJi
 * @Version 1.0
 */
public class ShapeFactory extends AbstractFactory {

  @Override
  public Shape getShape(String shape) {

    if (!StringUtils.hasLength(shape)){
      return null;
    }
    switch (shape){
      case "Rectangle":
        return new Rectangle();
      case "Circle":
        return new Circle();
      case "Square":
        return new Square();
      default:
        return null;
    }

  }

  @Override
  public Color getColor(String color) {
    return null;
  }

}
